<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        window.onload = function () {
            var a = 10;
            var b = 20;
            var c = a + b;
            //alert("a+b="+c);
            //document.write("a+b="+c);
            //console.log("a+b="+c);
            var myDiv = document.getElementById("div1");
            myDiv.textContent = "a+b=" + c;
            myDiv.style.color = "#336699";
            myDiv.style.fontSize = "2em";
            myDiv.style.fontWeight = "粗体";
        }
    </script>
</head>
<body>
<div id="div1">

</div>
</body>
</html>